<%@page pageEncoding="utf-8" contentType="text/html; charset=utf-8" %>
<%@ include file="/store/include/init_store.jsp" %>
<%
	
	
	
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
	<title><%= HOME_NAME %></title>
	<%@ include file="/home/include/cssnjs.jsp"  %>
	<script type="text/javascript">
	$(document).ready(function() {
		$('#member_id').focus();

		//로그인버튼
		$('#regist_btn').click(function(){//JSON호출 버튼이벤트

			if ($("#member_id").val() == "") {
				alert("이메일을 입력하세요");
				$("#member_id").focus();
				return false;
			}
		
			if ($("#member_name").val() == "") {
				alert("성명을 입력하세요");
				$("#member_name").focus();
				return false;
			}

			if ($("#member_pw").val() == "") {
				alert("비밀번호를 입력하세요");
				$("#member_pw").focus();
				return false;
			}

			$.ajax({
				url: '/store/help/memberRegist.do',
				type: "GET",
			    dataType: 'json',//html,text,json
			    data: { //파라미터
			    	member_id : $('#member_id').val(),
					member_pw : $('#member_pw').val()
			    },
			    error: function(data, status, err){
			    	alert(err);
			    },
				success: function(data){
					
					if (data.result) {

						if ($("#returnUrl").val()=="") {
							document.location.href = data.nextUrl;
						} else {
							document.location.href = $("#returnUrl").val();
						}
					} else {
						$('#member_pw').val("");
						$('#member_pw').focus();
						alert(data.message);
					}
			    }
			});

		});

		//비밀번호에서 엔터입력시 로그인 실행.
		$('#member_pw').keyup(function(e) {
			if (e.keyCode == 13) {
				$('#regist_btn').click();
			}
		});
	});

	</script>
</head>
<body>
<body>
	<div id="wrap">
		<%@ include file="/store/include/header.jsp"  %>
		
		<div id="contents">
			<h2>회원가입</h2>
			<div id="login">
            	
					<input type="hidden" name="returnUrl" id="returnUrl" value=""/>
					
					<div>
						<h3>이메일</h3> <input type="text" class="text" name="member_id" id="member_id"  value=""/>
					</div>
					<div>
						<h3>성명</h3> <input type="text" class="text" name="member_name" id="member_name"  value=""/>
					</div>
					<div>
						<h3>비밀번호</h3><input type="password" class="text" name="member_pw" id="member_pw" value="" />
					</div>
					<div>
						<h3>비밀번호 확인</h3><input type="password" class="text" name="member_pw_chk" id="member_pw_chk" value="" />
					</div>
					<div>
						<h3>&nbsp;</h3>
						<button id="regist_btn" class="btn" title="회원가입">가입하기</button>
					</div>
					
				
			</div>
			
             
		</div>
		
		<%@ include file="/store/include/footer.jsp"  %>		
	</div>

</body>
</html>
